<% if @webhook.errors.any? %>
  $('#alert p').html("<%= escape_javascript(@webhook.errors.full_messages.join('<br/>')) %>");
  $('#alert').fadeIn();
<% else %>
  $('#alert p').html("Webhook '<%= @webhook.host %>' has been created successfully");
  $('#alert').fadeIn();

  $('#add_webhook_form').fadeOut();
  $('#add_webhook_btn i').addClass("fa-plus-circle")
  $('#add_webhook_btn i').removeClass("fa-minus-circle")

  if ($('#webhooks').length > 0) {
    $("<%= escape_javascript(render partial: "webhooks/webhook", locals: {namespace: @namespace,webhook: @webhook}) %>").appendTo("#webhooks");
  }
<% end %>
